package ZhuanQuan;

import java.util.ArrayList;
import java.util.List;

/**
 * User: cool
 * Date: 2017/11/21
 * Time: 17:23
 * 50个人围坐一圈，当数到三或者三的倍数出圈，问剩下的人是谁，原来的位置是多少
 */
public class Main {

    public static void main(String[] args){
        Integer.parseInt("");
        List<People> list = new ArrayList<>();
        for (int i = 0; i < 50; i++) {
            People  people = new People();
            people.setPosition(i);
            if(list.size()>0 && list.get(i-1)!=null){
                people.setPrevPeop(list.get(i-1));
                list.get(i-1).setNextPeople(people);
            }else{
                people.setPrevPeop(null);
            }

            list.add(people);

        }
        list.get(0).setPrevPeop(list.get(list.size()-1));
        list.get(list.size()-1).setNextPeople(list.get(0));



        int index = 0;
        while (list.size()>1){

        }
        System.out.println(list.get(0).getPosition());
    }
}
